<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <canvas id="canvas" style="border: 1px solid red"></canvas>
    <script>
      const canvas = document.getElementById("canvas");
      const ctx = canvas.getContext("2d");

      // ctx.beginPath();
      // ctx.fillStyle = "lightblue";
      // ctx.arc(100, 75 / 2, 75 / 2, 0, Math.PI * 2);
      // ctx.clip();
      // ctx.save();

      // ctx.fillStyle = "blue";
      // ctx.fillRect(0, 0, 300, 150);

      let r = new Path2D();
      r.rect(80, 10, 45, 130);
      r.rect(40, 50, 120, 50);
      ctx.clip(r, "evenodd");
      ctx.fillStyle = "red";
      ctx.fillRect(0, 0, 300, 150);
    </script>
  </body>
</html>
